package cn.yunhe;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class KeyDao extends BaseDB implements ISouDao {
    Connection conn=null;
    PreparedStatement psmt=null;
    ResultSet rs=null;

    public List<String> getKeyword(String keyword){
        List<String> list = new ArrayList<>();
        try{
            conn=getConn();
            String sql = "select * from tb_liuyan where liu_title like ?";
            psmt=conn.prepareStatement(sql);
            psmt.setString(1,keyword+"%");
            rs=psmt.executeQuery();
            while (rs.next()){
                list.add(rs.getString("liu_title"));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return list;
    }
}
